package lec05.am.sw;

import java.awt.FlowLayout;
import java.awt.Label;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.math.BigInteger;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;

public class Caculator extends JFrame implements ActionListener{
	JTextField ta, tb, tc;
	JButton eq;
	public Caculator() {
		this.setLayout(new FlowLayout());
		this.add(ta = new JTextField(10));
		this.add(new Label("*"));
		this.add(tb = new JTextField(10));
		this.add(eq = new JButton("="));
		this.add(tc = new JTextField(10));
		this.setSize(400, 100);
		eq.addActionListener(this);
		this.setVisible(true);
		setSize(400,100);
		setVisible(true);
	}
	public static void main(String[] args) {
		new Caculator();
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == eq) {
			BigInteger ba=new BigInteger(ta.getText());
			BigInteger bb=new BigInteger(tb.getText());
			String bc=ba.multiply(bb).toString();
			tc.setSize(200, tc.getHeight());
			tc.setText(bc);

		}
	}

}
